package com.ymatou.iapi.fastturnover.testcase;

import java.text.SimpleDateFormat;
import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.fastturnover.parameter.queryAccountListBean;
import com.ymatou.iapi.fastturnover.service.queryAccountListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.model.fastturnover.account_config;
import com.ymttest.database.model.fastturnover.account_configExample;
import com.ymttest.database.model.fastturnover.account_config_log;
import com.ymttest.database.model.fastturnover.account_config_logExample;
import com.ymttest.database.sqlwapper.fastturnover.account_configWrapper;
import com.ymttest.database.sqlwapper.fastturnover.account_config_logWrapper;
import com.ymttest.utils.EnvSetup;
/**
*查询配置
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_queryAccountList{
	private static queryAccountListBean bean;
	private static queryAccountListCall call;
	
	SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
	Long fastturnover_seller=Long.parseLong(EnvSetup.getData("fastturnover_seller"));
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询配置");
	}

	@Before
	public void caseUp() {
		bean=new queryAccountListBean();
		call=new queryAccountListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(call.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_queryAccountList_001() {
		Logger.start(true,"查询配置-SellerId 传入sellerId");
		try {
			
			bean.setSellerId(fastturnover_seller);
			bean.setPageIndex(1);
			bean.setPageSize(5);
			call.setData(bean);
			call.callService();			
			
			account_configExample example=new account_configExample();
		    example.createCriteria().andSeller_idEqualTo(bean.getSellerId());
			account_configWrapper logWapper=new account_configWrapper();
			List<account_config> logs=logWapper.selectByExample(example);
			Logger.verifyEquals(call.getResult().length(), logs.size(), "验证数量");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_queryAccountList_002() {
		Logger.start(true,"查询配置-SellerId 不传入sellerId");
		try {
			
			//bean.setSellerId(fastturnover_seller);
			bean.setPageIndex(1);
			bean.setPageSize(50);
			call.setData(bean);
			call.callService();			
			
			account_configExample example=new account_configExample();
		  //  example.createCriteria().andSeller_idEqualTo(bean.getSellerId());
			account_configWrapper logWapper=new account_configWrapper();
			List<account_config> logs=logWapper.selectByExample(example);
			Logger.verifyEquals(call.getResult().length(), logs.size(), "验证数量");
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}